#include "stdafx.h"
#include "AchieveSeries.h"
#include "InstanceTouch.h"
#include <algorithm>
DECL_INSTANCE_TOUCH(ETouch_AchieveSeries);

struct  AchieveSeriesDefReflectionRegister
{
	AchieveSeriesDefReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(AchieveSeries,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(AchieveSeries,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();

		REGISTER_REFLECTION_MEMBER(AchieveSeries,m_iOrder,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(AchieveSeries,m_sIcon,std::string("default_icon")).Editor_SetAsRaw();
		
		GlobalClassManager::Instance().RegisterClass(AchieveSeries::s_GetReflection(),eDefaultDef_AchieveSeries);
		GlobalDefManager::Instance().RegisterDefManger(&AchieveSeriesManager::Instance());

	}
}___AchieveSeriesDefReflectionRegister;

rewrite  void AchieveSeries::OnArchieveReaded()
{
}
static bool __CompareSeriesByOrder(const AchieveSeries* pA,const AchieveSeries* pB )
{
	return pA->m_iOrder<pB->m_iOrder;
}
void AchieveSeriesManager::OnArchieveReaded()
{
	__AchieveSeriesManager::OnArchieveReaded();
	m_vOrderedSeries.clear();
	this->Enumerate(m_vOrderedSeries);
	std::sort(m_vOrderedSeries.begin(),m_vOrderedSeries.end(),__CompareSeriesByOrder);
	
}